//
//  P1464.cpp
//  Algorithm
//
//  Created by 刘锦程 on 2023/9/24.
//

#include <stdio.h>
#include <iostream>
#include<math.h>
using namespace std;
long long ans[30][30][30];
long long wfun(long long a,long long b,long long c){
    if(a<=0||b<=0||c<=0) return 1;
    else if(ans[a][b][c]!=0) return ans[a][b][c];
    else if(a>20||b>20||c>20) ans[a][b][c]=wfun(20,20,20);
    else if(a<b&&b<c) ans[a][b][c]=wfun(a,b,c-1)+wfun(a,b-1,c-1)-wfun(a,b-1,c);
    else ans[a][b][c]=wfun(a-1,b,c)+wfun(a-1,b-1,c)+wfun(a-1,b,c-1)-wfun(a-1,b-1,c-1);
    return ans[a][b][c];
}
int P1464ans(){
    long long n1 = 0,n2=0,n3=0;
    while(1){
        scanf("%lld%lld%lld",&n1,&n2,&n3);
        getchar();
        if(n1==-1&&n2==-1&&n3==-1) break;
        printf("w(%lld, %lld, %lld) = ",n1,n2,n3);
        if((n1>20||n2>20||n3>20)&&(n1>0&&n2>0&&n3>0)){
            n1=21;
            n2=21;
            n3=21;
        }
        printf("%lld\n",wfun(n1,n2,n3));
    }
    
    return 0;
}
